package com.boot.dto;

import lombok.Data;
import org.camunda.bpm.engine.repository.ProcessDefinition;

@Data
public class ProcessDefinitionDto {
    private String id;
    private String key;
    private String name;
    private int version;
    private String deploymentId;
    private boolean suspended;

    // 构造方法
    public ProcessDefinitionDto() {

    }

    public ProcessDefinitionDto(String id, String key, String name, int version,
                                String deploymentId, boolean suspended) {
        this.id = id;
        this.key = key;
        this.name = name;
        this.version = version;
        this.deploymentId = deploymentId;
        this.suspended = suspended;
    }

    // 静态工厂方法
    public static ProcessDefinitionDto from(ProcessDefinition definition) {
        return new ProcessDefinitionDto(
            definition.getId(),
            definition.getKey(),
            definition.getName(),
            definition.getVersion(),
            definition.getDeploymentId(),
            definition.isSuspended()
        );
    }
}
